package com.openbravo.pos.printer.ticket;

import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.List;

public class PrintItemLine
  implements PrintItem
{
  protected Font font;
  protected int fontheight;
  protected int textsize;
  protected List<StyledText> m_atext;

  public PrintItemLine(int paramInt1, Font paramFont, int paramInt2)
  {
    this.textsize = paramInt1;
    this.font = paramFont;
    this.fontheight = paramInt2;
    this.m_atext = new ArrayList();
  }

  public void addText(int paramInt, String paramString)
  {
    this.m_atext.add(new StyledText(paramInt, paramString));
  }

  public void draw(Graphics2D paramGraphics2D, int paramInt1, int paramInt2, int paramInt3)
  {
    MyPrinterState localMyPrinterState = new MyPrinterState(this.textsize);
    float f = paramInt1;
    for (int i = 0; i < this.m_atext.size(); i++)
    {
      StyledText localStyledText = (StyledText)this.m_atext.get(i);
      paramGraphics2D.setFont(localMyPrinterState.getFont(this.font, localStyledText.style));
      paramGraphics2D.drawString(localStyledText.text, f, paramInt2);
      f = (float)(f + paramGraphics2D.getFontMetrics().getStringBounds(localStyledText.text, paramGraphics2D).getWidth());
    }
  }

  public int getHeight()
  {
    return this.fontheight * MyPrinterState.getLineMult(this.textsize);
  }

  protected static class StyledText
  {
    public int style;
    public String text;

    public StyledText(int paramInt, String paramString)
    {
      this.style = paramInt;
      this.text = paramString;
    }
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.printer.ticket.PrintItemLine
 * JD-Core Version:    0.6.0
 */